local skel = fk.CreateSkill {
  name = "emo__liehou",
  tags = {Skill.Compulsory},
}

Fk:loadTranslationTable{
  ["emo__liehou"] = "裂喉",
  [":emo__liehou"] = "锁定技，出牌阶段开始时，若你已受伤，你将扣减体力上限至体力值，并摸扣减数张牌，然后若体力值最小，视为使用一张【杀】。",
}

skel:addEffect(fk.EventPhaseStart, {
  anim_type = "drawcard",
  can_trigger = function(self, event, target, player, data)
    return target == player and player:hasSkill(skel.name) and player.phase == Player.Play and player:isWounded()
  end,
  on_use = function(self, event, target, player, data)
    local room = player.room
    local n = player.maxHp - player.hp
    room:changeMaxHp(player, -n)
    if player.dead then return end
    player:drawCards(n, skel.name)
    if player:isAlive() and table.every(room.alive_players, function (p)
      return p.hp >= player.hp
    end) then
      room:askToUseVirtualCard(player, {
        name = "slash", skill_name = skel.name, cancelable = false, skip = false,
        extra_data = {bypass_distances = true, bypass_times = true, extraUse = true},
      })
    end
  end,
})

return skel
